<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "SELECT distinct `district_id`,`district_name`,`block_id`,`block_name` FROM `tbl_lookup_location` where `district_id` = ".$distId." group by `block_id`";
$queryReport = mysql_query($sqlReport);
?>

<table border="0" width="900" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">Block and Scheme wise pumping assets in the district (as per PHED)</font></span>
		<div>
		  <div align="center"><span style="font-size: 9pt; font-weight: 700">
	        <font face="Verdana" color="#224568"> Table 15</font></span></div>
		</div>
		</td>
	</tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="900" cellspacing="0" cellpadding="0" height="47" bgcolor="#C5D8EB">
			<tr>
				<td width="80" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Name of Block</font></td>
				<td width="41" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Type of Scheme</font></td>
				<td width="60" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Total pumping sets installed</font></td>
				<td width="70" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Total number of Standby Pumping sets</font></td>
				<td width="60" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Operational Pumping Sets</font></td>
				<td width="60" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Power rating (hp)</font></td>
			</tr>
            <?php
			//$numVillage=0;
			//$numFormVill=0;
			while($rowReport = mysql_fetch_array($queryReport)) {
			 $a=getPumpingInformation($rowReport['block_id'],'Piped'); 
			 $b=getPumpingInformation($rowReport['block_id'],'P&T')+getPumpingInformation($rowReport['block_id'],'TSS(P&T)');
			 $c=getPumpingInformation($rowReport['block_id'],'Sanitary Diggs');
			 $d=getHPInformation($rowReport['block_id']);
			 $Total1=$a+$b+$c+$d;
			 $e=getPumpingStatusInformation($rowReport['block_id'],'standby','Piped');
			 $f=getPumpingStatusInformation($rowReport['block_id'],'standby','P&T')+getPumpingStatusInformation($rowReport['block_id'],'standby','TSS(P&T)');
			 $g=getPumpingStatusInformation($rowReport['block_id'],'standby','Sanitary Diggs');
			$Total2=$e+$f+$g+0;
			$h=getPumpingStatusInformation($rowReport['block_id'],'operational','Piped');
			$i=getPumpingStatusInformation($rowReport['block_id'],'operational','P&T')+getPumpingStatusInformation($rowReport['block_id'],'operational','TSS(P&T)');
			$j=getPumpingStatusInformation($rowReport['block_id'],'operational','Sanitary Diggs');
			$k=getTotalFunctionalStatusNoBlockWise($rowReport['district_id'],$rowReport['block_id']);
			$Total3=$h+$i+$j+$k;
			$l=getPowerRatingInformation($rowReport['block_id'],'Piped');
			$m=getPowerRatingInformation($rowReport['block_id'],'P&T')+getPowerRatingInformation($rowReport['block_id'],'TSS(P&T)');
			$n=getPowerRatingInformation($rowReport['block_id'],'Sanitary Diggs');
			//$Total4=$l+$m+$n+0;
				
				 ?>  
				<tr bgcolor="#FFFFFF">
				
				<td width="" rowspan="4" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['block_name']; ?></font></td>
				<td align="left" width=""><font face="Verdana" style="font-size: 8.5pt">Piped</font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo  $a;//getPumpingInformation($rowReport['block_id'],'Piped'); ?></font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'standby','Piped'); ?></font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'operational','Piped'); ?>
				</font>
				</td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $pr_info1=number_format(getPowerRatingInformation($rowReport['block_id'],'Piped'),2,'.','');?>
				</font>
				</td>
			    </tr>
				<tr bgcolor="#FFFFFF">
				  <td align="left"><font face="Verdana" style="font-size: 8.5pt">P&T</font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo  $b;//getPumpingInformation($rowReport['block_id'],'P&T'); ?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'standby','P&T')+getPumpingStatusInformation($rowReport['block_id'],'standby','TSS(P&T)'); ?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'operational','P&T')+getPumpingStatusInformation($rowReport['block_id'],'operational','TSS(P&T)'); ?>
				  </font>
				  </td>
				  <td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $pr_info2=number_format(getPowerRatingInformation($rowReport['block_id'],'P&T')+getPowerRatingInformation($rowReport['block_id'],'TSS(P&T)'),2,'.','');?>
				</font>
				</td>
		  </tr>
				<tr bgcolor="#FFFFFF">
				  <td align="left"><font face="Verdana" style="font-size: 8.5pt">Sanitary Diggs</font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo  $c;//getPumpingInformation($rowReport['block_id'],'WSS'); ?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'standby','Sanitary Diggs'); ?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getPumpingStatusInformation($rowReport['block_id'],'operational','Sanitary Diggs'); ?>
				  </font>
				  </td>
				  <td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $pr_info3=number_format(getPowerRatingInformation($rowReport['block_id'],'Sanitary Diggs'),2,'.','');?>
				</font>
				</td>
		  </tr>
				<tr bgcolor="#FFFFFF">
				  <td align="left"><font face="Verdana" style="font-size: 8.5pt">HP</font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $d;//getHPInformation($rowReport['block_id']);?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo "0";?></font></td>
		          <td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo getTotalFunctionalStatusNoBlockWise($rowReport['district_id'],$rowReport['block_id']);?>
				   </font>
				  </td>
				  <td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $pr_info4="0.00";?>
				</font>
				</td>
		  </tr>
			<tr bgcolor="#E9E9E9">
				
				<td width="" align="center" colspan="2"><div align="left"><font face="Verdana" style="font-size: 8.5pt">Total</font></div></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $Total1;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $Total2;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $Total3;?>
				</font>
				</td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $Total4=number_format($pr_info1+$pr_info2+$pr_info3+$pr_info4,2,'.','');?>
				</font>
				</td>
			</tr>
			
				 <?php	
				 $GrandTotal1+=$Total1;
				 $GrandTotal2+=$Total2;
				 $GrandTotal3+=$Total3;
				 $GrandTotal4+=$Total4;
         	}
			?>	
			<tr bgcolor="#E9E9E9">
				
				<td width="" align="center" colspan="2"><div align="left"><font face="Verdana" style="font-size: 8.5pt">Grand Total</font></div></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $GrandTotal1;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $GrandTotal2;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $GrandTotal3;?>
				</font>
				</td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo number_format($GrandTotal4,2,'.','');?>
				</font>
				</td>
			</tr>	
		</table>
		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>



</body>

</html>